package com.tensquare.friend.client.fallback;

import com.tensquare.friend.client.UserClient;
import entity.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author: WangYaWei
 * @description:
 * @create: 2019-08-29 13:36
 **/
@Component
@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {

    @Override
    public UserClient create(Throwable throwable) {
        log.error(throwable.getMessage());
        return new UserClient() {
            @Override
            public Result incFansCount(String userid, int x) {
                return null;
            }

            @Override
            public Result incincFollowCount(String userid, int x) {
                return null;
            }
        };
    }
}
